Skip to content

fix(examples): make next-best-offer compile — bump anthropic-sdk + zod - #8

Merged
rrader26 merged 1 commit into
mainfrom
fix/example-deps
Jul 2, 2026
Merged

fix(examples): make next-best-offer compile — bump anthropic-sdk + zod#8
rrader26 merged 1 commit into
mainfrom
fix/example-deps

Conversation

@rrader26

@rrader26 rrader26 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Problem

The next-best-offer example (shipped in v0.3.0) did not type-check against its pinned devDeps:

  • It calls client.messages.parse() + zodOutputFormat from @anthropic-ai/sdk/helpers/zod + output_config.format (the structured-outputs API) — none of which exist in the pinned @anthropic-ai/sdk@0.68.0 (that version only has betaZodTool under helpers/beta/zod).
  • zodOutputFormat expects zod v4 types (it imports from zod/v4), but the devDep was pinned to zod@^3.25.

Net: npm run demo:nbo couldn't compile. Caught while verifying the example end-to-end.

Fix

  • @anthropic-ai/sdk ^0.68.0^0.109.1
  • zod ^3.25.0^4.0.0

Both are dev-only (used solely by the example, no src/ import) — the published dist and the @thinkfleet/memory-sdk@0.3.0 package on npm are unaffected.

Validation

  • ✅ Example type-checks against the new deps (tsc --noEmit incl. examples/next-best-offer.ts)
  • npm run typecheck + npm run build (main SDK) still pass
  • npm ci lockfile in sync

Follow-up (not in this PR)

CI/tsconfig don't currently type-check examples/**, which is why this slipped in. Worth adding an example-typecheck step so it can't regress.

🤖 Generated with Claude Code

…est-offer

The next-best-offer example uses client.messages.parse() + zodOutputFormat
from @anthropic-ai/sdk/helpers/zod + output_config.format — the structured
outputs API. Those landed after 0.68.0, and zodOutputFormat expects zod v4
types (imports from zod/v4), so the example did not type-check against the
pinned devDeps. Bumps both so `npm run demo:nbo` compiles and runs.

Dev-only deps (example only) — not part of the published dist; the 0.3.0
package on npm is unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rrader26
rrader26 merged commit 87b85bb into main Jul 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants